package org.example.webaiproject05.exception;

import lombok.extern.slf4j.Slf4j;
import org.example.webaiproject05.pojo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.sql.SQLIntegrityConstraintViolationException;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler
    public Result error(Exception e) {
        log.error("异常处理",e);
        return Result.error("服务器异常");
    }
}



